package com.zhongke.cotrun.mapper;

import com.zhongke.cotrun.model.pojo.Tags;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigInteger;

public interface TagsMapper {
    /**
     * 新建点赞
     *
     * @param tags
     * @return
     */
    @Options(useGeneratedKeys = true, keyProperty = "tagsId", keyColumn = "tags_id")
    @Insert("INSERT INTO `tags` (`link_comment_id`, `garde`,`count`,`type`) VALUES (#{linkCommentId}, #{garde},0,#{type})")
    public boolean insertTagrs(Tags tags);

    /**
     *更新点赞数
     * @param count
     * @param tagsId
     * @return
     */
    @Update("UPDATE tags SET count=#{count} WHERE tags_id=#{tagsId}")
    public Boolean updateTagrsValues(@Param("count") Integer count, @Param("tagsId") BigInteger tagsId);

    /**
     * 根据条件查询点赞数量
     * @param tags
     * @return
     */
    public  Tags seleTagsByComment(Tags tags);
}
